from customFunction import auto_add, two_response, flex_args, square_sum, kw

if __name__ == '__main__':
    # 引入方法
    print(auto_add(1))

    # 方法返回2个值
    a, b = two_response(3, 6)
    print(f'a={a} b={b}')

    # 灵活入参，不传就取默认值
    flex_args(1)
    flex_args(1, 5)

    # 可变参数，类似于java的(int... nums)
    square_sum(1, 2, 3, 4)
    nums1 = [1, 2]          # list
    nums2 = (1, 2, 3, 4)    # tuple
    # list和tuple传入时，前面加*号，可自动转换
    square_sum(*nums1)
    square_sum(*nums2)

    body = {'Amy': 28, 'Mike': 65, 'Tom': '男人'}
    kw('Jack', **body)
    kw('Tony', age='13', weight=120)
